rest_api using tweets are not dumping into file in python
according to this code a file should be with 5000 tweets in this. But nothing is going into file and shows json serialization error.
here is the code alltweet=[] def rest_query_ex3(): MAX_ID = None query = "(disease OR illness OR sickness)" file=open("tweetfile.txt", "a+") for it in range(50): tweets = myApi.search(q=query, count=100, max_id=MAX_ID) if tweets: MAX_ID = tweets[-1].id alltweet.extend(tweets) for tweet in alltweet: s=[tweet.text, tweet.id] file.write(json.dumps(s)) file.close()
You must be logged in to post. Please login or register an account.